﻿using System;
using System.Collections.Generic;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;
using ToolsLayer;
using System.Data;

namespace Webcar.Car
{
    public partial class GpsTJReport : System.Web.UI.Page
    {
        protected void Page_Load(object sender, EventArgs e)
        {
            if (this.IsPostBack) return;
            LoadData();
        }

        void LoadData()
        {
            string sql = @"SELECT b.dept_name
                      ,[cjdw]
                      ,[cjdw_lxr]
                      ,[cjdw_dh]
                      ,[gps_num]
                      ,[tbr]
                      ,[tbr_lxdh]
                      ,[tbrq]
                      ,[note]
                  FROM [gps_tj] a,DEPT b
                  where a.dept_code = b.DEPT_CODE";
            DataTable table  = DB.ExecuteDataset(sql).Tables[0];
            this.GridView1.DataSource = table;
            this.GridView1.DataBind();
            this.Label1.Text = "总共车辆数合计："+table.Compute("sum(gps_num)","").ToString();
        }
    }
}
